00001 // 00002 // Copyright (c) 2013 Battelle Memorial Institute 00003 // Licensed under modified BSD License. A copy of this license can be found 00004 // in the LICENSE file in the top level directory of this distribution. 00005 // 00006 // Emacs Mode Line: -*- Mode:c++;-*- 00007 // ------------------------------------------------------------- 00008 /** 00009 * @file sanity_interface.h 00010 * @author William A. Perkins 00011 * @date Mon Mar 25 10:56:55 2013 00012 * 00013 * @brief 00014 * 00015 * 00016 */ 00017 // ------------------------------------------------------------- 00018 // ------------------------------------------------------------- 00019 // Created March 25, 2013 by William A. Perkins 00020 // Last Change: Thu Jun 3 06:45:08 2010 by William A. Perkins <d3g096@PE10900.pnl.gov> 00021 // ------------------------------------------------------------- 00022 00023 #ifndef _sanity_interface_h_ 00024 #define _sanity_interface_h_ 00025 00026 namespace gridpack { 00027 namespace utility { 00028 00029 // ------------------------------------------------------------- 00030 // class SanityInterface 00031 // ------------------------------------------------------------- 00032 /** 00033 * This class serves as the base for any class that needs to provide a 00034 * check of itself. 00035 * 00036 */ 00037 00038 class SanityInterface { 00039 public: 00040 00041 /// Default constructor. 00042 SanityInterface(void) {} 00043 00044 /// Copy constructor 00045 SanityInterface(const SanityInterface& old) {} 00046 00047 /// Destructor 00048 virtual ~SanityInterface(void) {} 00049 00050 /// Is this instance OK? 00051 bool sane(void) const 00052 { 00053 return this->sanity_check_(); 00054 } 00055 00056 00057 protected: 00058 00059 /// Specialized way to check this instance 00060 virtual bool sanity_check_(void) const = 0; 00061 00062 }; 00063 00064 } // namespace utility 00065 } // namespace gridpack 00066 00067 00068 #endif